<template>
  <div class="mlt">
    <div style="margin-bottom: 10px">
      <h2>盘点单号：{{ list.sn }} 日期：{{ list.date }}</h2>
      <el-button @click="goBack">返回</el-button>
    </div>
    <div>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column label="时间" prop="updated_at" />
        <el-table-column label="商品名称" prop="goods_name" />
        <el-table-column label="规格名称" prop="attr_name" />
        <el-table-column label="盘点金额" prop="inventory_cost" />
        <el-table-column label="原金额" prop="original_cost" />
        <el-table-column label="盘点数量" prop="inventory_qty" />
        <el-table-column label="原数量" prop="original_qty" />
      </el-table>
    </div>
  </div>
</template>

<script>
  import { invDetail } from '@/api/commodity'

  export default {
    props: {
      detailsdata: {
        type: Object,
        required: true,
      },
    },
    data() {
      return {
        tableData: [],
        list: {},
      }
    },
    watch: {},
    mounted() {
      this.init()
    },
    methods: {
      init() {
        const data = {
          id: this.detailsdata.id,
        }
        invDetail(data).then((e) => {
          this.tableData = e.data.item
          this.list = {
            sn: e.data.order_sn,
            date: e.data.order_date,
          }
        })
      },
      goBack() {
        this.$emit('showMain', 0)
      },
    },
  }
</script>

<style></style>
